package com.hyts.jgit.base.model;

import com.hyts.jgit.config.GitParamConfiguration;
import lombok.Builder;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * project-name:coffice-toolbox
 * package-name:com.hyts.gitclient.base.model
 * author:Libo/Alex
 * create-date:2019-06-14 22:07
 * copyright:libo-hyts-github
 * email:libo2dev@aliyun.com
 * description:此类主要用于: git的结果返回对象模型
 */
@Accessors(chain = true)
@Builder
@Data
public class ResultModel<T> {

    @Setter
    @Getter
    private int code;

    @Setter
    @Getter
    private String message;

    @Setter
    @Getter
    private T data;


    public static ResultModel success(String message){
        return ResultModel.builder().code(GitParamConfiguration.DEFAULT_SUCCESS_CODE).message(message).build();
    }


    public static ResultModel failure(String message){
        return ResultModel.builder().code(GitParamConfiguration.DEFAULT_FAILURE_CODE).message(message).build();
    }

}
